package com.ruoyi.yyq.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yyq.mapper.CarVerificationRecordMapper;
import com.ruoyi.yyq.domain.CarVerificationRecord;
import com.ruoyi.yyq.service.ICarVerificationRecordService;

/**
 * 服务核销记录Service业务层处理
 * 
 * @author 尹永青
 * @date 2025-05-12
 */
@Service
public class CarVerificationRecordServiceImpl implements ICarVerificationRecordService 
{
    @Autowired
    private CarVerificationRecordMapper carVerificationRecordMapper;

    /**
     * 查询服务核销记录
     * 
     * @param id 服务核销记录主键
     * @return 服务核销记录
     */
    @Override
    public CarVerificationRecord selectCarVerificationRecordById(Long id)
    {
        return carVerificationRecordMapper.selectCarVerificationRecordById(id);
    }

    /**
     * 查询服务核销记录列表
     * 
     * @param carVerificationRecord 服务核销记录
     * @return 服务核销记录
     */
    @Override
    public List<CarVerificationRecord> selectCarVerificationRecordList(CarVerificationRecord carVerificationRecord)
    {
        return carVerificationRecordMapper.selectCarVerificationRecordList(carVerificationRecord);
    }

    /**
     * 新增服务核销记录
     * 
     * @param carVerificationRecord 服务核销记录
     * @return 结果
     */
    @Override
    public int insertCarVerificationRecord(CarVerificationRecord carVerificationRecord)
    {
        return carVerificationRecordMapper.insertCarVerificationRecord(carVerificationRecord);
    }

    /**
     * 修改服务核销记录
     * 
     * @param carVerificationRecord 服务核销记录
     * @return 结果
     */
    @Override
    public int updateCarVerificationRecord(CarVerificationRecord carVerificationRecord)
    {
        return carVerificationRecordMapper.updateCarVerificationRecord(carVerificationRecord);
    }

    /**
     * 批量删除服务核销记录
     * 
     * @param ids 需要删除的服务核销记录主键
     * @return 结果
     */
    @Override
    public int deleteCarVerificationRecordByIds(Long[] ids)
    {
        //标记操作成功次数
        int success = 0;
        // 假删除
        for (Long id : ids) {
            CarVerificationRecord record = new CarVerificationRecord();
            record.setId(id);
            record.setDeleted(1L);
            carVerificationRecordMapper.updateCarVerificationRecord(record);
            success++;
        }
        return success;
    }

    /**
     * 删除服务核销记录信息
     * 
     * @param id 服务核销记录主键
     * @return 结果
     */
    @Override
    public int deleteCarVerificationRecordById(Long id)
    {
        CarVerificationRecord record = new CarVerificationRecord();
        record.setId(id);
        record.setDeleted(1L);
        return carVerificationRecordMapper.updateCarVerificationRecord(record);
    }
}
